#define _CRT_SECURE_NO_WARNINGS
#include <stack>
#include <iostream>
using namespace std;
class MyQueue {
    stack<int> pushStack;
    stack<int> popStack;
public:
    MyQueue() {

    }

    void push(int x) {
        pushStack.push(x);
    }

    int pop() {
        if (popStack.empty())
        {
            while (!pushStack.empty())
            {
                popStack.push(pushStack.top());
                pushStack.pop();
            }
        }
        int res = popStack.top();
        popStack.pop();
        return res;
    }

    int peek() {
        if (popStack.empty())
        {
            while (!pushStack.empty())
            {
                popStack.push(pushStack.top());
                pushStack.pop();
            }
        }
        return popStack.top();
    }

    bool empty() {
        return popStack.empty() && pushStack.empty();
    }
};

/**
 * Your MyQueue object will be instantiated and called as such:
 * MyQueue* obj = new MyQueue();
 * obj->push(x);
 * int param_2 = obj->pop();
 * int param_3 = obj->peek();
 * bool param_4 = obj->empty();
 */
int main()
{
    MyQueue mq;
    mq.push(1);
    mq.push(2);
    cout << mq.peek() << endl;
    return 0;
}